var ws, did, uid, spage;
document.addEventListener('plusready', function(){
	ws = plus.webview.currentWebview();
	did = ws.did;	//医生id
	spage = ws.spage;
	uid = plus.storage.getItem('uid');
	console.log(did);
	//
	var star = 0;
	$('.iconfont span').on('click', function(){
		star = $(this).index() + 1;
		$(this).addClass('font-col');
		$(this).prevAll().addClass('font-col');
		$(this).nextAll().removeClass('font-col');
	})
	$('header span').on('click', function(){
		var cont = $('textarea[name=cont]').val();
		if(!cont.trim()){
			toast('请输入评论内容');return;
		}
		$.ajax({
			type:"get",
			url:apiRoot+"/home/Bespoke/ping",
			data:{
				uid : uid,
				did : did, 
				cont :cont,
				star :star
			},
			success :function(data){
				console.log(data);
				if(data > 0){
					toast('添加成功');
					if(spage)plus.webview.getWebviewById(spage).reload();
					setTimeout(function(){
						ws.close();
					}, 1000)
				}
			},
			error :function(e){
				errortoast();
			}
		});
	})
},false)